<template>
  <div class="home">
    <Show
        :total="total"
        :add="add"
        :recovered="recovered"
        :death="death">
    </Show>
    <Map/>
  </div>
</template>

<script>
// @ is an alias to /src
import Map from '@/components/Map.vue'
import Show from "@/components/Show";

export default {
  name: 'Home',
  components: {
    Map, Show
  },
  data() {
    return {
      total: 0,
      add: 0,
      recovered: -1,
      death: -1
    }
  },
  mounted() {
    this.getCount();
  },
  methods: {
    getCount() {
      this.$axios.post("/china").then(res => {
        this.total = res.data.data.sum;
        this.add = res.data.data.add;
        this.death = res.data.data.death;
        this.recovered = res.data.data.recovered;
      })
    }
  }
}
</script>
